//
//  DangerZone.m
//  ProjectL
//
//  Created by Nguyen Tan Loc on 8/16/13.
//  Copyright (c) 2013 Nguyen Tan Loc. All rights reserved.
//

#import "DangerZone.h"

@implementation DangerZone

-(id) init
{
    if (self = [super initWithSpriteFrameName:[self getSpriteFrameName]])
    {
        
        [self createBody];
    }
    
    return self;
}

-(void) createBody
{
    b2BodyDef bodyDef;
    bodyDef.type = b2_dynamicBody;
    bodyDef.position.Set(0, 0);
    
    _b2Body = PhysicSystem::getInstance()->mWorld->CreateBody(&bodyDef);
    
    b2CircleShape shape;
    shape.m_radius = 10.0f / PTM_RATIO;
    
    b2FixtureDef fixtureDef;
    fixtureDef.shape = &shape;
    fixtureDef.filter.categoryBits = [self getObjectType];
    fixtureDef.filter.maskBits = MASK_BIT_BOMB;
    _b2Body->CreateFixture(&fixtureDef);
    
    [self setPTMRatio:PTM_RATIO];
    _b2Body->SetUserData(self);
}

-(OBJECT_TYPE) getObjectType
{
    
    return eO_BOMB;
}

-(NSString *) getSpriteFrameName
{
    return SFN_BOMB;
}

@end
